"""
# -*- coding: utf-8 -*-
# @Time    : 2023/6/5 9:52
# @Author  : 王摇摆
# @FileName: Data3.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""
'''
使用自定义的MLE算法进行数据降维操作
'''
from sklearn.datasets import make_blobs
from sklearn.decomposition import PCA

X, y = make_blobs(n_samples=10000, n_features=3, centers=[[3, 3, 3], [0, 0, 0], [1, 1, 1], [2, 2, 2]],
                  cluster_std=[0.2, 0.1, 0.2, 0.2],
                  random_state=9)

pca = PCA(n_components='mle', svd_solver='full')
pca.fit(X)
print(pca.explained_variance_ratio_)
print(pca.explained_variance_)
print(pca.n_components_)
